<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('game_matches', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('game_id');
            $table->string('type')->comment('比赛类型：预选赛|正赛');
            $table->dateTime('start_at')->comment('比赛时间');
            $table->string('screen')->comment('场地名');
            $table->bigInteger('next_match_id')->nullable()->comment('下一场比赛id');
            $table->string('sort')->comment('排序');
            $table->string('loss')->default('n')->comment('是否为败者空场');
            $table->bigInteger('left_member_id')->nullable()->comment('对战用户id');
            $table->bigInteger('right_member_id')->nullable()->comment('对战用户id');
            $table->bigInteger('win_member_id')->nullable()->comment('获胜用户id');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('game_matches');
    }
};
